<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>HelloWorld</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
    <h1>v-bind 实例</h1>
    <hr>
    <div id="app">
       <img v-bind:src="imgSrc" width="200px" alt="">
       <p>
            <a :href="webUrl" target="_blank">技术胖</a>
       </p>
       <hr>
       <div :class="className">1 绑定class</div>
       <div :class="{classA:isOK}">2 绑定class中的判断</div>
       <div :class="{classA,classB}">3 绑定class数组</div>
       <div :class="isOK?classA:classB">4 绑定class数组,三元运算符</div>
       <hr>
       <div>
           <input type="checkbox" name="isOK" v-model="isOK" >
           <label for="isOK">isOK={{isOK}}</label>
       </div>
       <hr>
       <div :style="{color:red,fontSize:font}">5 绑定style值</div>
       <div :style="styleObject">5 绑定style值,对象</div>
    </div>
    <style>
        .classA{
            color:red;
        }
        .classB{
            font-size: 150%;
        }
    </style>
    <script type="text/javascript">
        var app = new Vue({
            el:'#app',
            data:{
                message:'Hello World111!',
                imgSrc:'https://wx4.sinaimg.cn/mw690/005MFBKwgy1fnkxt42hnbj30qo0qo45j.jpg',
                webUrl:'https://weibo.com/hadelababy',
                className:'classA',
                isOK:true,
                classA:'classA',
                classB:'classB',
                red:'red',
                font:'20px',
                styleObject:{
                    color:'green',
                    //vue不支持font-size的写法,需要更改为fontSize
                    fontSize:'150%'
                }
            }
        })
    </script>
</body>
</html>